package emulator.unittest.hardware.nmos6502.commands;

import static org.junit.Assert.*;

import org.junit.Test;

import emulator.EmulatorException;
import emulator.hardware.nmos6502.Cpu6502;
import emulator.hardware.nmos6502.Flags6502;
import emulator.hardware.nmos6502.commands.SED;
import emulator.unittest.hardware.nmos6502.MockOperand;

public class SEDTest {
	@Test
	public void testSetFlagFromFalse() throws EmulatorException {
		Cpu6502 cpu = new Cpu6502();
		cpu.setFlags(new Flags6502(0));
		SED sed = new SED();
		sed.execute(cpu, new MockOperand(0));
		assertEquals(true, cpu.getFlags().getDecimal());
	}

	@Test
	public void testSetFlagFromTrue() throws EmulatorException {
		Cpu6502 cpu = new Cpu6502();
		cpu.setFlags(new Flags6502(Flags6502.FLAG_DECIMAL));
		SED sed = new SED();
		sed.execute(cpu, new MockOperand(0));
		assertEquals(true, cpu.getFlags().getDecimal());
	}
}
